import { ADD_PERSON } from '../constant'
const initState = [{ key: 122323, name: 'xdfg', age: 12 }]
export default function personReducer(preState = initState, action) {
  console.log('personReducer')

  const { type, data } = action
  switch (type) {
    case ADD_PERSON:
      // 这里不可以用push 改变了初始值，无法监听到变化
      return [...preState, data]

    default:
      return preState
  }
}
